# coding=utf-8
"""
    @Author：SimpleTree
    @date：2025/4/21 22:47
    @desc: 
"""
import pymysql

# 连接到 MySQL 数据库
conn = pymysql.connect(host='localhost', user='root', password='root', database='ai-toy')
cursor = conn.cursor()


# 执行查询
cursor.execute('SELECT * FROM c_baby')

# 以下打印输出：
# ('id', 8, None, 20, 20, 0, False)
# ('baby_name', 253, None, 1020, 1020, 0, True)
# ('baby_nick_name', 253, None, 1020, 1020, 0, True)
# ('baby_sex', 254, None, 4, 4, 0, True)
# ('birthday', 12, None, 19, 19, 0, True)
# ('sort', 3, None, 11, 11, 0, True)
# ('deleted', 16, None, 1, 1, 0, True)
# ('create_user', 8, None, 20, 20, 0, True)
# ('create_time', 12, None, 19, 19, 0, True)
# 获取列描述信息
description = cursor.description
for column in description:
    print(column)

resut = cursor.fetchall()
print(f"resut: {resut}")

# 关闭连接
conn.close()


